<test>
  <sql>SELECT	TOP 5
		e.LastName + ', ' + e.FirstName Employee,
		COUNT(*) [Territory Count],
		CONCAT(r.RegionDescription) Regions,
		CONCAT(t.TerritoryDescription) Territories

FROM	Region r,
		Employees e,
		Territories t,
		EmployeeTerritories et
	
WHERE	e.EmployeeID = et.EmployeeID
AND		t.TerritoryID = et.TerritoryID
AND     r.RegionID = t.RegionID

GROUP   BY e.LastName + ', ' + e.FirstName

ORDER	BY COUNT(*) DESC
</sql>
  <expectedResults>
    <NewDataSet>
  <xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Table1" msdata:Locale="en-US">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="Employee" type="xs:string" minOccurs="0" />
                <xs:element name="Territory_x0020_Count" type="xs:int" minOccurs="0" />
                <xs:element name="Regions" type="xs:string" minOccurs="0" />
                <xs:element name="Territories" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <Table1>
    <Employee>King, Robert</Employee>
    <Territory_x0020_Count>10</Territory_x0020_Count>
    <Regions>Western</Regions>
    <Territories>Campbell, Chicago, Colorado Springs, Denver, Hoffman Estates, Menlo Park, San Francisco, Santa Clara, Santa Cruz, Santa Monica</Territories>
  </Table1>
  <Table1>
    <Employee>Buchanan, Steven</Employee>
    <Territory_x0020_Count>7</Territory_x0020_Count>
    <Regions>Eastern</Regions>
    <Territories>Edison, Fairport, Mellvile, Morristown, New York, Providence</Territories>
  </Table1>
  <Table1>
    <Employee>Dodsworth, Anne</Employee>
    <Territory_x0020_Count>7</Territory_x0020_Count>
    <Regions>Northern</Regions>
    <Territories>Bloomfield Hills, Hollis, Minneapolis, Portsmouth, Roseville, Southfield, Troy</Territories>
  </Table1>
  <Table1>
    <Employee>Fuller, Andrew</Employee>
    <Territory_x0020_Count>7</Territory_x0020_Count>
    <Regions>Eastern</Regions>
    <Territories>Bedford, Boston, Braintree, Cambridge, Georgetow, Louisville, Westboro</Territories>
  </Table1>
  <Table1>
    <Employee>Suyama, Michael</Employee>
    <Territory_x0020_Count>5</Territory_x0020_Count>
    <Regions>Western</Regions>
    <Territories>Bellevue, Phoenix, Redmond, Scottsdale, Seattle</Territories>
  </Table1>
</NewDataSet>
  </expectedResults>
  <expectedPlan>
    <executionPlan>
      <element operator="Select">
        <properties>
          <property name="Output List.[0]" value="Expr1008 AS Employee" />
          <property name="Output List.[0].Column" value="Expr1008" />
          <property name="Output List.[0].DataType" value="String" />
          <property name="Output List.[0].Output Name" value="Employee" />
          <property name="Output List.[1]" value="Expr1011 AS Territory Count" />
          <property name="Output List.[1].Column" value="Expr1011" />
          <property name="Output List.[1].DataType" value="Int32" />
          <property name="Output List.[1].Output Name" value="Territory Count" />
          <property name="Output List.[2]" value="Expr1012 AS Regions" />
          <property name="Output List.[2].Column" value="Expr1012" />
          <property name="Output List.[2].DataType" value="String" />
          <property name="Output List.[2].Output Name" value="Regions" />
          <property name="Output List.[3]" value="Expr1013 AS Territories" />
          <property name="Output List.[3].Column" value="Expr1013" />
          <property name="Output List.[3].DataType" value="String" />
          <property name="Output List.[3].Output Name" value="Territories" />
        </properties>
        <input>
          <element operator="Top">
            <properties>
              <property name="Output List.[0]" value="Expr1008" />
              <property name="Output List.[0].Column" value="Expr1008" />
              <property name="Output List.[0].DataType" value="String" />
              <property name="Output List.[1]" value="Expr1011" />
              <property name="Output List.[1].Column" value="Expr1011" />
              <property name="Output List.[1].DataType" value="Int32" />
              <property name="Output List.[2]" value="Expr1012" />
              <property name="Output List.[2].Column" value="Expr1012" />
              <property name="Output List.[2].DataType" value="String" />
              <property name="Output List.[3]" value="Expr1013" />
              <property name="Output List.[3].Column" value="Expr1013" />
              <property name="Output List.[3].DataType" value="String" />
              <property name="Statistics.Open Count" value="1" />
              <property name="Statistics.Row Count" value="5" />
              <property name="Statistics.Average Row Count" value="5" />
              <property name="Limit" value="5" />
              <property name="With Ties" value="False" />
            </properties>
            <input>
              <element operator="Sort">
                <properties>
                  <property name="Output List.[0]" value="Expr1008" />
                  <property name="Output List.[0].Column" value="Expr1008" />
                  <property name="Output List.[0].DataType" value="String" />
                  <property name="Output List.[1]" value="Expr1011" />
                  <property name="Output List.[1].Column" value="Expr1011" />
                  <property name="Output List.[1].DataType" value="Int32" />
                  <property name="Output List.[2]" value="Expr1012" />
                  <property name="Output List.[2].Column" value="Expr1012" />
                  <property name="Output List.[2].DataType" value="String" />
                  <property name="Output List.[3]" value="Expr1013" />
                  <property name="Output List.[3].Column" value="Expr1013" />
                  <property name="Output List.[3].DataType" value="String" />
                  <property name="Statistics.Open Count" value="1" />
                  <property name="Statistics.Row Count" value="6" />
                  <property name="Statistics.Average Row Count" value="6" />
                  <property name="Logical Operator" value="Sort" />
                  <property name="Order By.[0]" value="Expr1011 DESC" />
                  <property name="Order By.[0].Column" value="Expr1011" />
                  <property name="Order By.[0].DataType" value="Int32" />
                  <property name="Order By.[0].Order" value="DESC" />
                </properties>
                <input>
                  <element operator="StreamAggregate">
                    <properties>
                      <property name="Output List.[0]" value="Expr1008" />
                      <property name="Output List.[0].Column" value="Expr1008" />
                      <property name="Output List.[0].DataType" value="String" />
                      <property name="Output List.[1]" value="Expr1011" />
                      <property name="Output List.[1].Column" value="Expr1011" />
                      <property name="Output List.[1].DataType" value="Int32" />
                      <property name="Output List.[2]" value="Expr1012" />
                      <property name="Output List.[2].Column" value="Expr1012" />
                      <property name="Output List.[2].DataType" value="String" />
                      <property name="Output List.[3]" value="Expr1013" />
                      <property name="Output List.[3].Column" value="Expr1013" />
                      <property name="Output List.[3].DataType" value="String" />
                      <property name="Statistics.Open Count" value="1" />
                      <property name="Statistics.Row Count" value="9" />
                      <property name="Statistics.Average Row Count" value="9" />
                      <property name="Defined Values.[0]" value="Expr1011 = COUNT(0)" />
                      <property name="Defined Values.[0].Target" value="Expr1011" />
                      <property name="Defined Values.[0].DataType" value="Int32" />
                      <property name="Defined Values.[0].Source" value="COUNT(0)" />
                      <property name="Defined Values.[1]" value="Expr1012 = CONCAT(r.RegionDescription)" />
                      <property name="Defined Values.[1].Target" value="Expr1012" />
                      <property name="Defined Values.[1].DataType" value="String" />
                      <property name="Defined Values.[1].Source" value="CONCAT(r.RegionDescription)" />
                      <property name="Defined Values.[2]" value="Expr1013 = CONCAT(t.TerritoryDescription)" />
                      <property name="Defined Values.[2].Target" value="Expr1013" />
                      <property name="Defined Values.[2].DataType" value="String" />
                      <property name="Defined Values.[2].Source" value="CONCAT(t.TerritoryDescription)" />
                      <property name="Group By.[0]" value="Expr1008" />
                      <property name="Group By.[0].Column" value="Expr1008" />
                      <property name="Group By.[0].DataType" value="String" />
                    </properties>
                    <input>
                      <element operator="Sort">
                        <properties>
                          <property name="Output List.[0]" value="t.TerritoryDescription" />
                          <property name="Output List.[0].Table" value="t" />
                          <property name="Output List.[0].Column" value="TerritoryDescription" />
                          <property name="Output List.[0].DataType" value="String" />
                          <property name="Output List.[1]" value="Expr1008" />
                          <property name="Output List.[1].Column" value="Expr1008" />
                          <property name="Output List.[1].DataType" value="String" />
                          <property name="Output List.[2]" value="r.RegionDescription" />
                          <property name="Output List.[2].Table" value="r" />
                          <property name="Output List.[2].Column" value="RegionDescription" />
                          <property name="Output List.[2].DataType" value="String" />
                          <property name="Statistics.Open Count" value="1" />
                          <property name="Statistics.Row Count" value="49" />
                          <property name="Statistics.Average Row Count" value="49" />
                          <property name="Logical Operator" value="Sort" />
                          <property name="Order By.[0]" value="Expr1008 ASC" />
                          <property name="Order By.[0].Column" value="Expr1008" />
                          <property name="Order By.[0].DataType" value="String" />
                          <property name="Order By.[0].Order" value="ASC" />
                        </properties>
                        <input>
                          <element operator="HashMatch">
                            <properties>
                              <property name="Output List.[0]" value="t.TerritoryDescription" />
                              <property name="Output List.[0].Table" value="t" />
                              <property name="Output List.[0].Column" value="TerritoryDescription" />
                              <property name="Output List.[0].DataType" value="String" />
                              <property name="Output List.[1]" value="Expr1008" />
                              <property name="Output List.[1].Column" value="Expr1008" />
                              <property name="Output List.[1].DataType" value="String" />
                              <property name="Output List.[2]" value="r.RegionDescription" />
                              <property name="Output List.[2].Table" value="r" />
                              <property name="Output List.[2].Column" value="RegionDescription" />
                              <property name="Output List.[2].DataType" value="String" />
                              <property name="Statistics.Open Count" value="1" />
                              <property name="Statistics.Row Count" value="49" />
                              <property name="Statistics.Average Row Count" value="49" />
                              <property name="Hash Keys Build" value="t.RegionID" />
                              <property name="Hash Keys Build.Table" value="t" />
                              <property name="Hash Keys Build.Column" value="RegionID" />
                              <property name="Hash Keys Build.DataType" value="Int32" />
                              <property name="Hash Keys Probe" value="r.RegionID" />
                              <property name="Hash Keys Probe.Table" value="r" />
                              <property name="Hash Keys Probe.Column" value="RegionID" />
                              <property name="Hash Keys Probe.DataType" value="Int32" />
                              <property name="Logical Operator" value="Inner Join" />
                            </properties>
                            <input>
                              <element operator="HashMatch">
                                <properties>
                                  <property name="Output List.[0]" value="t.TerritoryDescription" />
                                  <property name="Output List.[0].Table" value="t" />
                                  <property name="Output List.[0].Column" value="TerritoryDescription" />
                                  <property name="Output List.[0].DataType" value="String" />
                                  <property name="Output List.[1]" value="t.RegionID" />
                                  <property name="Output List.[1].Table" value="t" />
                                  <property name="Output List.[1].Column" value="RegionID" />
                                  <property name="Output List.[1].DataType" value="Int32" />
                                  <property name="Output List.[2]" value="Expr1008" />
                                  <property name="Output List.[2].Column" value="Expr1008" />
                                  <property name="Output List.[2].DataType" value="String" />
                                  <property name="Statistics.Open Count" value="1" />
                                  <property name="Statistics.Row Count" value="49" />
                                  <property name="Statistics.Average Row Count" value="49" />
                                  <property name="Hash Keys Build" value="et.EmployeeID" />
                                  <property name="Hash Keys Build.Table" value="et" />
                                  <property name="Hash Keys Build.Column" value="EmployeeID" />
                                  <property name="Hash Keys Build.DataType" value="Int32" />
                                  <property name="Hash Keys Probe" value="e.EmployeeID" />
                                  <property name="Hash Keys Probe.Table" value="e" />
                                  <property name="Hash Keys Probe.Column" value="EmployeeID" />
                                  <property name="Hash Keys Probe.DataType" value="Int32" />
                                  <property name="Logical Operator" value="Inner Join" />
                                </properties>
                                <input>
                                  <element operator="HashMatch">
                                    <properties>
                                      <property name="Output List.[0]" value="et.EmployeeID" />
                                      <property name="Output List.[0].Table" value="et" />
                                      <property name="Output List.[0].Column" value="EmployeeID" />
                                      <property name="Output List.[0].DataType" value="Int32" />
                                      <property name="Output List.[1]" value="t.TerritoryDescription" />
                                      <property name="Output List.[1].Table" value="t" />
                                      <property name="Output List.[1].Column" value="TerritoryDescription" />
                                      <property name="Output List.[1].DataType" value="String" />
                                      <property name="Output List.[2]" value="t.RegionID" />
                                      <property name="Output List.[2].Table" value="t" />
                                      <property name="Output List.[2].Column" value="RegionID" />
                                      <property name="Output List.[2].DataType" value="Int32" />
                                      <property name="Statistics.Open Count" value="1" />
                                      <property name="Statistics.Row Count" value="49" />
                                      <property name="Statistics.Average Row Count" value="49" />
                                      <property name="Hash Keys Build" value="et.TerritoryID" />
                                      <property name="Hash Keys Build.Table" value="et" />
                                      <property name="Hash Keys Build.Column" value="TerritoryID" />
                                      <property name="Hash Keys Build.DataType" value="String" />
                                      <property name="Hash Keys Probe" value="t.TerritoryID" />
                                      <property name="Hash Keys Probe.Table" value="t" />
                                      <property name="Hash Keys Probe.Column" value="TerritoryID" />
                                      <property name="Hash Keys Probe.DataType" value="String" />
                                      <property name="Logical Operator" value="Inner Join" />
                                    </properties>
                                    <input>
                                      <element operator="TableScan">
                                        <properties>
                                          <property name="Table" value="EmployeeTerritories AS et" />
                                          <property name="Output List.[0]" value="et.EmployeeID" />
                                          <property name="Output List.[0].Table" value="et" />
                                          <property name="Output List.[0].Column" value="EmployeeID" />
                                          <property name="Output List.[0].DataType" value="Int32" />
                                          <property name="Output List.[1]" value="et.TerritoryID" />
                                          <property name="Output List.[1].Table" value="et" />
                                          <property name="Output List.[1].Column" value="TerritoryID" />
                                          <property name="Output List.[1].DataType" value="String" />
                                          <property name="Statistics.Open Count" value="1" />
                                          <property name="Statistics.Row Count" value="49" />
                                          <property name="Statistics.Average Row Count" value="49" />
                                        </properties>
                                        <input />
                                      </element>
                                      <element operator="TableScan">
                                        <properties>
                                          <property name="Table" value="Territories AS t" />
                                          <property name="Output List.[0]" value="t.TerritoryID" />
                                          <property name="Output List.[0].Table" value="t" />
                                          <property name="Output List.[0].Column" value="TerritoryID" />
                                          <property name="Output List.[0].DataType" value="String" />
                                          <property name="Output List.[1]" value="t.TerritoryDescription" />
                                          <property name="Output List.[1].Table" value="t" />
                                          <property name="Output List.[1].Column" value="TerritoryDescription" />
                                          <property name="Output List.[1].DataType" value="String" />
                                          <property name="Output List.[2]" value="t.RegionID" />
                                          <property name="Output List.[2].Table" value="t" />
                                          <property name="Output List.[2].Column" value="RegionID" />
                                          <property name="Output List.[2].DataType" value="Int32" />
                                          <property name="Statistics.Open Count" value="1" />
                                          <property name="Statistics.Row Count" value="53" />
                                          <property name="Statistics.Average Row Count" value="53" />
                                        </properties>
                                        <input />
                                      </element>
                                    </input>
                                  </element>
                                  <element operator="ComputeScalar">
                                    <properties>
                                      <property name="Output List.[0]" value="e.EmployeeID" />
                                      <property name="Output List.[0].Table" value="e" />
                                      <property name="Output List.[0].Column" value="EmployeeID" />
                                      <property name="Output List.[0].DataType" value="Int32" />
                                      <property name="Output List.[1]" value="Expr1008" />
                                      <property name="Output List.[1].Column" value="Expr1008" />
                                      <property name="Output List.[1].DataType" value="String" />
                                      <property name="Statistics.Open Count" value="1" />
                                      <property name="Statistics.Row Count" value="9" />
                                      <property name="Statistics.Average Row Count" value="9" />
                                      <property name="Defined Values.[0]" value="Expr1008 = e.LastName + ', ' + e.FirstName" />
                                      <property name="Defined Values.[0].Target" value="Expr1008" />
                                      <property name="Defined Values.[0].DataType" value="String" />
                                      <property name="Defined Values.[0].Source" value="e.LastName + ', ' + e.FirstName" />
                                    </properties>
                                    <input>
                                      <element operator="TableScan">
                                        <properties>
                                          <property name="Table" value="Employees AS e" />
                                          <property name="Output List.[0]" value="e.EmployeeID" />
                                          <property name="Output List.[0].Table" value="e" />
                                          <property name="Output List.[0].Column" value="EmployeeID" />
                                          <property name="Output List.[0].DataType" value="Int32" />
                                          <property name="Output List.[1]" value="e.LastName" />
                                          <property name="Output List.[1].Table" value="e" />
                                          <property name="Output List.[1].Column" value="LastName" />
                                          <property name="Output List.[1].DataType" value="String" />
                                          <property name="Output List.[2]" value="e.FirstName" />
                                          <property name="Output List.[2].Table" value="e" />
                                          <property name="Output List.[2].Column" value="FirstName" />
                                          <property name="Output List.[2].DataType" value="String" />
                                          <property name="Statistics.Open Count" value="1" />
                                          <property name="Statistics.Row Count" value="9" />
                                          <property name="Statistics.Average Row Count" value="9" />
                                        </properties>
                                        <input />
                                      </element>
                                    </input>
                                  </element>
                                </input>
                              </element>
                              <element operator="TableScan">
                                <properties>
                                  <property name="Table" value="Region AS r" />
                                  <property name="Output List.[0]" value="r.RegionID" />
                                  <property name="Output List.[0].Table" value="r" />
                                  <property name="Output List.[0].Column" value="RegionID" />
                                  <property name="Output List.[0].DataType" value="Int32" />
                                  <property name="Output List.[1]" value="r.RegionDescription" />
                                  <property name="Output List.[1].Table" value="r" />
                                  <property name="Output List.[1].Column" value="RegionDescription" />
                                  <property name="Output List.[1].DataType" value="String" />
                                  <property name="Statistics.Open Count" value="1" />
                                  <property name="Statistics.Row Count" value="4" />
                                  <property name="Statistics.Average Row Count" value="4" />
                                </properties>
                                <input />
                              </element>
                            </input>
                          </element>
                        </input>
                      </element>
                    </input>
                  </element>
                </input>
              </element>
            </input>
          </element>
        </input>
      </element>
    </executionPlan>
  </expectedPlan>
</test>